package com.wuhunyu.controller;

import com.wuhunyu.commonutils.result.CommonResult;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * 模拟登录
 *
 * @author wuhunyu
 * @version 1.0
 * @date 2021-01-14 20:58
 */
@RestController
@RequestMapping("/eduTeacher/user")
//@CrossOrigin
public class EduTeacherLoginController {

    @PostMapping("/login")
    public CommonResult login(@RequestParam(value = "username",required = false) String username,@RequestParam(value = "password",required = false) String password) {
        Map<String, Object> map = new HashMap<>(16);
        // token
        map.put("token", "wuhunyu");
        return CommonResult.success("登录成功", map);
    }

    @GetMapping("/info")
    public CommonResult info() {
        Map<String, Object> map = new HashMap<>(16);
        // roles
        map.put("roles", "[admin]");
        // data
        map.put("name", "wuhunyu");
        // avatar
        map.put("avatar", "https://wuhunyu.oss-cn-heyuan.aliyuncs.com/20210116/2b36da0690a8485eafd52408497894af.png");
        return CommonResult.success("获取用户信息成功", map);
    }

}
